﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UIT.Controls.Containers;
using UIT.Controls;
using UIT.Web.Controls.Html;
using System.Windows.Markup;
using System.Collections;

namespace UIT.Web.Controls
{
	[ContentProperty("Children")]
	public class Head : HtmlControl, IList, IContainer
	{
		private IDisposableObservableCollection<IContainer, IControl> children;
		public Head()
			: base("head", true)
		{
			children = new DisposableObservableCollection<IContainer, IControl>(this);
		}

		public int Add(object value)
		{
			return children.Add(value);
		}

		public void Clear()
		{
			((IList)children).Clear();
		}

		public bool Contains(object value)
		{
			return children.Contains(value);
		}

		public int IndexOf(object value)
		{
			return children.IndexOf(value);
		}

		public void Insert(int index, object value)
		{
			children.Insert(index, value);
		}

		public bool IsFixedSize
		{
			get { return children.IsFixedSize; }
		}

		public bool IsReadOnly
		{
			get { return ((IList)children).IsReadOnly; }
		}

		public void Remove(object value)
		{
			children.Remove(value);
		}

		public void RemoveAt(int index)
		{
			children.RemoveAt(index);
		}

		public object this[int index]
		{
			get
			{
				return children[index];
			}
			set
			{
				children[index] = value;
			}
		}

		public void CopyTo(Array array, int index)
		{
			children.CopyTo(array, index);
		}

		public int Count
		{
			get { return ((ICollection)children).Count; }
		}

		public bool IsSynchronized
		{
			get { return children.IsSynchronized; }
		}

		public object SyncRoot
		{
			get { return children.SyncRoot; }
		}

		public IEnumerator GetEnumerator()
		{
			return children.GetEnumerator();
		}

		public IDisposableObservableCollection<IContainer, IControl> Children
		{
			get { return children; }
		}
	}
}
